#pragma once
#include <list>

/*! \class Drawable
	* \brief Structure representing a drawable item.
	*  Every drawable item inherit this class, including Entities and Tiles
	* \author Xerxes
	* \version 0.3
	* \date 20/02/2013 - 22/02/2013
*/
class Drawable
{
public:
	/**
		* \fn Drawable(float z=0)
		* \param z : the layer index of the item.
		* The item will be added in the list at the right index automatically
	*/
	Drawable(float z = 0);

	/**
		* \fn ~Drawable(void)
		* \brief Item destructor
		* The item will be removed of the list
	*/
	~Drawable(void);

	/**
	 * \fn void SetZIndex(float index)
	 * \brief Index modification
	 *
	 * \param z The new index.
	 * Change the z index to another value, re-sorting the static list accordingly.
	 */
	void SetZIndex(float index); 

	/**
	 * \return the layer position
	 */
	float ZIndex(){return z_index;}
	
	static void DrawAll();
	virtual void Draw() = 0;
	
	bool IsVisible(){return visible;}
	void SetVisible(bool value){visible = value;}
private:

	static std::list<Drawable*> all_drawables;
	void insert();
	float z_index;
	bool visible;
};

